import httpInstance from "@/utils/http"; // 引入axios实例

// 封装banner的接口, 它接收一个 params 对象作为参数，默认值为空对象 {}。
export function getBannerAPI(params = {}) {
  // 解构赋值，从params中获取distributionSite属性，如果params为空则默认值为1 
  // 传入商品为2
  const {distributionSite = '1'} = params
  return httpInstance({
    url: '/home/banner', //baseURL+url ,url默认GET 
    params:{
      distributionSite // 同接口文档
    }
  })
}

/**
 * @description: 获取新鲜好物
 */
export const findNewAPI = () => {
  return httpInstance({
    url: '/home/new'
  })
}

/**
 * @description: 获取人气推荐
 * @param {*}
 * @return {*}
 */
export const getHotAPI = () => {
  return httpInstance({
    url: '/home/hot'
  })
}
/**
 * @description: 获取所有商品模块
 * @param {*}
 * @return {*}
 */
export const getGoodsAPI = () => {
  return httpInstance({
    url: '/home/goods'
  })
}